// META: title=test WebNN API reshape operation
// META: global=window,dedicatedworker
// META: variant=?cpu
// META: variant=?gpu
// META: variant=?npu
// META: script=../resources/utils.js
// META: timeout=long

'use strict';

// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-reshape-method
// Alter the shape of a tensor to a new shape.
//
// MLOperand reshape(
//     MLOperand input, sequence<[EnforceRange] unsigned long> newShape);


const getReshapePrecisionTolerance = (graphResources) => {
  const toleranceValueDict = {float32: 0, float16: 0};
  const expectedDataType =
      getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs);
  return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]};
};

const reshapeTests = [
  {
    'name': 'reshape float32 tensor to a new shape (reorder all dimensions)',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 2, 3]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 2, 3], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape float32 tensor to a new shape (reduce dimensions)',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 1, 1, 1, 6], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 1, 1, 6]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 1, 1, 6], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape float32 tensor to a new shape (extend dimensions)',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 2, 2, 3, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 2, 2, 3, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape float32 tensor to a new shape (4D to 4D)',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [3, 2, 2, 2], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 2, 3, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 2, 3, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape float32 tensor to 1D tensor',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [3, 2, 2, 2], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (squeeze) float32 2D tensor by eliminating one dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (squeeze) float32 3D tensor by eliminating one dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 1, 6], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (squeeze) float32 3D tensor by eliminating two dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (squeeze) float32 4D tensor by eliminating two dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 4, 1, 6], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (squeeze) float32 4D tensor by eliminating all dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [-33.82555389404297],
          'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': []}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [-33.82555389404297],
          'descriptor': {'dimensions': [], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (squeeze) float32 5D tensor by eliminating four dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 1, 1, 24, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (squeeze) float32 2D tensor by eliminating 1st dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (squeeze) float32 3D tensor by eliminating 2nd and 3rd dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24, 1, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (squeeze) float32 4D tensor by eliminating 1st and 4th dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 4, 6, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (squeeze) float32 5D tensor by eliminating 2nd and 3rd dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 1, 1, 12, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 12, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 12, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (squeeze) float32 5D tensor by eliminating 1st, 2nd and 5th dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 1, 1, 24, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 0D tensor to 4D',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [-33.82555389404297],
          'descriptor': {'dimensions': [], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 1, 1, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [-33.82555389404297],
          'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 1D tensor by adding one dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 1D tensor by adding two dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 1D tensor to 5D',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments':
            [{'input': 'reshapeInput'}, {'newShape': [1, 1, 1, 24, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 1, 1, 24, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (unsqueeze) float32 1D tensor by adding 2nd and 3rd dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24, 1, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24, 1, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 2D tensor by adding one dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 1, 6]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 1, 6], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 2D tensor by adding two dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 4, 1, 6]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 4, 1, 6], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 2D tensor by adding 1st dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (unsqueeze) float32 2D tensor by adding 1st and 4th dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 4, 6, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 4, 6, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name':
        'reshape (unsqueeze) float32 3D tensor by adding 2nd and 3rd dimensions',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 12, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments':
            [{'input': 'reshapeInput'}, {'newShape': [2, 1, 1, 12, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 1, 1, 12, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 4D tensor by adding 2nd dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 1, 2, 2, 3]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 1, 2, 2, 3], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (unsqueeze) float32 5D tensor by adding 4th dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 1, 4, 3, 1], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments':
            [{'input': 'reshapeInput'}, {'newShape': [2, 1, 4, 1, 3, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor':
              {'dimensions': [2, 1, 4, 1, 3, 1], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (flatten) float32 3D tensor to 2D',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 12]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 12], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (flatten) float32 4D to 2D',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (flatten) float32 4D to 2D exclusive 1st dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'}
        }
      }
    }
  },
  {
    'name': 'reshape (flatten) float32 4D to 2D exclusive 4th dimension',
    'graph': {
      'inputs': {
        'reshapeInput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}
        }
      },
      'operators': [{
        'name': 'reshape',
        'arguments': [{'input': 'reshapeInput'}, {'newShape': [24, 1]}],
        'outputs': 'reshapeOutput'
      }],
      'expectedOutputs': {
        'reshapeOutput': {
          'data': [
            -30.0561466217041,  99.56941986083984,   88.04620361328125,
            -91.87507629394531, -23.7972354888916,   -91.28665161132812,
            -63.15204620361328, 12.0669527053833,    -96.1172866821289,
            -44.77365493774414, -80.08650970458984,  -64.43756866455078,
            27.64195442199707,  -96.86306762695312,  83.6834716796875,
            50.599483489990234, -20.18765640258789,  -1.3904608488082886,
            -96.93603515625,    65.34143829345703,   34.835994720458984,
            62.01485824584961,  -2.8698415756225586, 27.903749465942383
          ],
          'descriptor': {'dimensions': [24, 1], 'dataType': 'float32'}
        }
      }
    }
  }
];

if (navigator.ml) {
  reshapeTests.forEach((test) => {
    webnn_conformance_test(
        buildGraphAndCompute, getReshapePrecisionTolerance, test);
  });
} else {
  test(() => assert_implements(navigator.ml, 'missing navigator.ml'));
}
